package com.atguigu.lease.web.admin.config;

import com.atguigu.lease.web.admin.converter.StringToBaseEnumConverterFactory;
import com.atguigu.lease.web.admin.converter.StringToItemTypeConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: MyWebMVCConfig
 * Package: com.atguigu.lease.web.admin.config
 * Description:
 *
 * @Author ygf
 * @Create 2024/9/26 17:32
 * @Version 1.0
 */
//@EnableConfigurationProperties(value = PathPatternProperties.class)
@SpringBootConfiguration
public class MyWebMVCConfig implements WebMvcConfigurer {
    /*@Autowired
    private StringToItemTypeConverter stringToItemTypeConverter;*/

    @Autowired
    private StringToBaseEnumConverterFactory stringToBaseEnumConverterFactory;


    @Override
    public void addFormatters(FormatterRegistry registry) {
        //注册参数转换器
        //registry.addConverter(stringToItemTypeConverter);
        //注册转换器工厂
        registry.addConverterFactory(stringToBaseEnumConverterFactory);
    }


}
